home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------------------
-
- FILENAME
- Additions.h
-
- DESCRIPTION
- This header file contains the declarations of the routines that create the graphical effects
- of the Additions printing extension. These routines allow the user to augment pages of a
- document with additive effects.
- These effects include:
-
- Adding a page border
- Serialize all printed copies
- Add cover page at beginning or end.
-
- These options are configured through a Print dialog panel.
-
- COPYRIGHT
- Copyright Apple Computer, Inc. 1991
- All rights reserved.
-
- INTERFACE ROUTINES
- ComposeCoverPage
- AddPageBorder
- CreateNumberShape
- SerializeCopies
-
- MODIFICATION HISTORY
- 05/15/91 ALA Initial Implementation
- 08/26/94 dmh Added "Length" macro.
-
-
- ------------------------------------------------------------------------------- */
-
- #define Length(pStr) ((unsigned char) pStr[0])
-
-
- /*==================================== GLOBALS ====================================*/
-
-
- extern gxShape gSerialShape;
-
-
- /*==================================== CONSTANTS ====================================*/
-
-
- /* ===== Constants for accessing the 'addi' collection item. ===== */
-
- #define kAdditionsCollectionType 'addi' /* Item type of the 'addi' Filter collection */
-
-
- /* ===== Constants for Identifying Cover Page First and Last ===== */
-
- #define kCoverPageFirst 0 /* Add cover page at beginning of document */
- #define kCoverPageLast 1 /* Add cover page at end of document */
-
-
- /*==================================== TYPES ====================================*/
-
-
- /* AdditionsCollection - structure defining the format of the 'addi' collection item. It defines the */
- /* type of additions to add to document pages. The Addition's Print time dialog panel */
- /* is used to set the values in this structure. This structure must match */
- /* the 'xdtl'resource in the Additions.r file. */
-
- typedef struct
- {
- long nextEndSerialNum; // ending serial number in the next batch to print
- char coverPage; // kCoverPageFirst or kCoverPageLast depending upon radio button settings
- Boolean addPageBorder; // true => add page border to document pages
- Boolean serializeCopies; // true => serialize all document pages
- Boolean addCoverPage; // true => add cover page to the document
- } AdditionsCollection, *AdditionsCollectionPtr, **AdditionsCollectionHdl;
-
-
- /*======================== INTERFACE ROUTINES =======================*/
-
-
- /*========================= INTERFACE ROUTINES FOR ADDING A COVER PAGE =========================*/
-
-
- /* ===== ComposeCoverPage =====
-
- ComposeCoverPage creates a picture which represents the cover page of the printed
- document.
- */
- OSErr ComposeCoverPage( // (out) Error code
- gxShape *coverPage, // (out) picture representing the cover page
- gxFormat theFormat, // (in) Cover page format reference
- gxJobInfo *printerInfo); // (in) Contains info. about the document being printed
-
-
- /*=================== INTERFACE ROUTINES FOR ADDING PAGE BORDER TO DOCUMENT PAGES ===================*/
-
-
- /* ===== AddPageBorder =====
-
- AddPageBorder adds a border around the entire page and and scales the page to make sure
- all shapes fit within the border. The page to border is specified by the "page" parameter.
-
- To add the page border, the routine performs the following steps:
- 1. Make a copy of the original page shape (newPage variable).
- 2. Scale the newPage shape by approx. 80%.
- 3. Scale any embedded bitmaps in the newPage shape. (graphics didn't handle this before).
- 4. Remove all shapes from the original page shape (page variable).
- 5. Add the newPage shape to the page shape (must preserve the original page referenced passed to us).
- 6. Add the shapes to the page shape which comprise the border.
-
- Note: the original page shape is duplicated because we must scale the contents of the shape,
- but not the shapes which comprise the border. Previously, it didn't work to scale the page down
- and scale the border up so it's bigger.
- */
- OSErr AddPageBorder( // (out) Error code
- gxShape page, // (in) picture for the page being spooled; we'll add a border to it
- gxFormat pageFormat, // (in) Page format record
- Str32 docName); // (in) Name of the document being printed
-
-
- /*======================== INTERFACE ROUTINES FOR SERIALIZING DOCUMENT PAGES =======================*/
-
-
- /* ===== CreateNumberShape =====
-
- CreateNumberShape creates a text shape which will be used to contain the serial number to
- be added to the pages of the document. This shape will exist for as long as the page
- exists. It's temporarily stored in the extension's refCon so we can retrieve it at render
- page time.
- */
- OSErr CreateNumberShape(void); // (out) error code
-
-
- /* ===== SerializeCopies =====
-
- SerializeCopies adds the copy # to each page which is printed.
- */
- void SerializeCopies( // (out) Error code
- gxShape page, // (in) picture for the page being spooled
- gxFormat pageFormat, // (in) Page format record
- long currCopyNum, // (in) Current copy of the document being printed (relative to beginning of the job)
- Boolean *pageChanged, // (out) True if a copy of a page has changed; otherwise ignored
- long nextEndSerialNum, // (in) last serial number in the batch being printed
- long numCopies); // (in) number of copies being printed
-